home *** CD-ROM | disk | FTP | other *** search
/ PC-SIG: Essential Home & Business / PC-SIG - Essential Home and Business Collection.iso / 22 / 3 / 4 / READ.MAN < prev    next >
Text File  |  1989-03-27  |  6KB  |  158 lines

  1.                      ▄▄▄▄  ▄   ▄   ▄  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄  ▄▄▄▄
  2.                      █  ▀  █   █   █  █                █  ▀
  3.                      █     █   █▄▄▄█  █▄▄▄  █▀▄▀█  █   █   
  4.                      █     █▄▄▄  █       █  █ █ █  █   █   
  5.                      █▄▄█  ▄▄▄▄▄▄▄▄▄▄▄▄▄▄█  █ █ █  █   █▄▄█
  6.                                         
  7.  
  8.              ┌─────────────────────────────────────────────────────┐
  9.              │                                                     │
  10.              │       R E A D L N   &   R E A D K E Y   V1.31       │
  11.              │                                                     │
  12.              └─────────────────────────────────────────────────────┘
  13.  
  14.         Program and Documentation are Copyright 1989 by clySmic software.
  15.                               All rights reserved.
  16.  
  17.      
  18.      READLN and READKEY are programs that get input from the keyboard and
  19.      place it in environment variables.  They're perfect for making
  20.      interactive batch files and MUCH easier to use than utilities that use
  21.      ERRORLEVEL to communicate the results.
  22.  
  23.      Just put READLN.EXE and READKEY.EXE in a directory on your PATH.
  24.  
  25.      
  26.  
  27.      READLN
  28.  
  29.      Usage: READLN "prompt" var
  30.  
  31.      This displays the prompt (which must be in double quotes and CAN
  32.      contain >,<, |, or an environment variable) and waits for input.  All
  33.      input up to an ENTER is placed in the environment variable var.  If the
  34.      first letter of var is capitalized, so will be the input.
  35.  
  36.      Example 1:
  37.  
  38.           C:\>readln "who are you? " name
  39.           who are you? Ralph
  40.      
  41.           C:\>set
  42.           NAME=Ralph
  43.           ...other environment variables...
  44.  
  45.      Example2:
  46.  
  47.           D:\>readln "Enter State Code: " State
  48.           Enter State Code: ny
  49.      
  50.           D:\>set
  51.           STATE=NY  [uppercased because the 1st letter of State was upper]
  52.           ...other environment variables...
  53.  
  54.      Of course, you would usually use the command in batch files.
  55.  
  56.      
  57.  
  58.      READKEY
  59.  
  60.      Usage: READKEY "prompt" var
  61.  
  62.      This displays the prompt (which must be in double quotes and CAN
  63.      contain >,<, |, or an environment variable) and waits for input.  ONE
  64.      character is read (no ENTER is needed) and it is placed in the
  65.      environment variable var.  If the first letter of var is capitalized,
  66.      so will be the input character.  If an extended key (function key,
  67.      arrow keys, &c.) is pressed, the ASCII representation of the
  68.      hexadecimal scan code for the key is placed in the variable.  If a
  69.      Carriage Return, Escape, BEL, or TAB is pressed, the ASCII
  70.      representation of the character's ASCII code is placed in the variable.
  71.  
  72.      Example 1:
  73.  
  74.           E:\>readkey "Your Choice (Y/N): " Choice
  75.           Your Choice (Y/N): Y  [its uppercased if you press y or Y]
  76.      
  77.           E:\>set
  78.           CHOICE=Y
  79.           ...other environment variables...
  80.  
  81.      Example2:
  82.  
  83.           F:\>readkey "Press  or  or F5 to exit ... " updown
  84.           Press  or  or F5 to exit ...   [F5 was pressed, nothing is seen]
  85.  
  86.           F:\>set
  87.           UPDOWN=3F00  [hex representation of F5]
  88.           ...other environment variables...
  89.  
  90.      
  91.  
  92.      PUTTING IT ALL TOGETHER
  93.  
  94.      Here's a batch file example:
  95.  
  96.      @echo off
  97.      rem INITIALIZE AND GET USER NAME
  98.      set CHOICE=JUNK
  99.      readln "Enter and sign in please: " name
  100.      :LOOP
  101.      rem READ AND PROCESS PROGRAM CHOICE
  102.      readkey "Hi %NAME%, F1 =Prog 1; F2 = Prog 2; Esc or X exits " Choice
  103.      if %CHOICE%/ == X/ goto END
  104.      if %CHOICE%/ == 1B/ goto END
  105.      if %CHOICE%/ == 3B00/ goto RUN1
  106.      if %CHOICE%/ == 3C00/ goto RUN2
  107.      rem ERROR TRAPPING
  108.      echo Wrong, Try Again...
  109.      goto LOOP
  110.      :RUN1
  111.      echo Program1
  112.      goto END
  113.      :RUN2
  114.      echo Program2
  115.      :END
  116.      rem CLEAN UP ENVIRONMENT AND LEAVE
  117.      NAME=
  118.      CHOICE=
  119.  
  120.      You would replace the ECHOs of program 1 & 2 with the commands to run
  121.      these programs.  The "/"s in the above example are to avoid syntax
  122.      errors in the IF statements if the user presses "=" or ";".  The var=
  123.      lines remove the variables from the environment.  If you leave unneeded
  124.      variables lying around, you'll probably fill up your environment.
  125.  
  126.      READLN/READKEY will work with DOS 3.3, 3.31, and 4.00.  Results for
  127.      other versions of DOS are unknown.
  128.  
  129.      
  130.  
  131.      READLN and READKEY are copyrighted by clySmic software, and is released
  132.      as "Freeware".
  133.  
  134.      You may copy the program and distribute it without charge.  You may not
  135.      sell or otherwise charge for READLN/READKEY.  However, users' groups
  136.      may charge a small fee (not to exceed $7) for media and postage.
  137.  
  138.      These programs are provided AS IS without any warranty, expressed or
  139.      implied, including but not limited to fitness for a particular purpose.
  140.      So there.
  141.  
  142.      clySmic software is not responsible for anything that may happen when
  143.      you use READLN/READKEY, including hardware damage, information loss, or
  144.      baldness.
  145.  
  146.      Donations cheerfully accepted.
  147.  
  148.      READLN and READKEY were written in Turbo Pascal with Turbo Professional
  149.      and TPEnv.
  150.  
  151.  
  152.  
  153.                                 Ralph B Smith Jr
  154.                                 clySmic software
  155.                                  P. O. Box 2271
  156.                                Empire State Plaza
  157.                                 Albany, NY 12220
  158.